package com.springbootblog.service.serviceImpl.fontend;

import com.springbootblog.controller.fontend.IndexController;
import com.springbootblog.dao.GossipDao;
import com.springbootblog.pojo.Gossip;
import com.springbootblog.service.fontend.GossipService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class GossipServiceImpl implements GossipService
{
    /**
     * 定义一个静态常量日志对象
     */
    private static final Logger logger = LoggerFactory.getLogger(IndexController.class);

    /**
     * 自动装载（dao接口注入）
     */
    @Autowired
    private GossipDao gossipDao;

    public Map<String,Object> getGossipList()
    {
        List<Gossip> gossipList = gossipDao.getGossipList();
        Map<String,Object> result = new HashMap<>(2);
        result.put("list",gossipList);
        result.put("code", 1);
        return result;
    }
}
